/**
 * Created by XianTao on 2016/11/10
 * <p/>
 * Copyright (c) 2015-2015
 * Apache License
 * Version 2.0, January 2004
 * http://www.apache.org/licenses/
 */
package org.lego.wechat.base.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.lego.jpa.base.entity.UUIDWithTimeEntity;

import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;

@Entity
@Table
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
public class WxCorp extends UUIDWithTimeEntity {
    private String corpId;
    @Lob
    private String corpSecret;
    private Integer agentId;    // 非企业号默认为0

    @Lob
    private String token;
    @Lob
    private String encodingAesKey;

    private String name;    // 微信号名称
    private String description; // 微信号描述

    /**
     * 拼接公众号唯一标识
     *
     * @return corpId:agentId
     */
    public String concatId() {
        return this.corpId.concat(":").concat(String.valueOf(agentId));
    }
}
